import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import homepage from '../views/homepage/homepage.vue'
import photos from '../views/photos.vue'
import svgs from '../views/svgs.vue'
import vip from '../views/vip.vue'
import search from '../views/search_result.vue'
import detail from '../views/detail.vue'

const routerPush = VueRouter.prototype.push;

VueRouter.prototype.push = function(location){
	return routerPush.call(this, location).catch(error=>error)
}




Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
	redirect: '/homepage',
	children: [
		{
			path: 'homepage',
			name: 'Homepage',
			component: homepage,
		},
		{
			path: '/photos',
			name: 'Photos',
			component: photos,
		},
		{
			path: 'svgs',
			name: 'Svgs',
			component: svgs,
		},
		{
			path: 'vip',
			name: 'Vip',
			component: vip,
		},
		{
			path:'search',
			name:'Search',
			component: search,
		},
		{
			path:'detail',
			name:'Detail',
			component: detail,
		}
	]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
